Есть желание использовать современные языковые фитчи, но переписывать код в ручную долго и скучно, тогда можно воспользоваться помощью искусственного интеллекта😄
Для того чтобы сделать свой код более современным используй следующий промпт:
Refactor the following code to modern [Тут напиши стандарт] programming standards:
[Сюда вставь свой код]
❗️Пример использования промпта:
Refactor the following code to modern c++23 programming standards:
int* createIntArray(int size) { int* arr = new int[size]; for (int i = 0; i < size; ++i) { arr[i] = i * i; } return arr; }
// Option 1: Return a std::vector (recommended for most cases) auto createIntArray(int size) -> std::vector<int> { std::vector<int> arr(size); std::ranges::generate(arr, [i = 0]() mutable { return i * i++; }); return arr; }
// Option 2: Return a std::unique_ptr (if you specifically need heap allocation) auto createIntArrayUnique(int size) -> std::unique_ptr<int[]> { auto arr = std::make_unique<int[]>(size); for (int i = 0; i < size; ++i) { arr[i] = i * i; } return arr; }
Это достаточно простой и быстрый способ привести код к текущему стандарту. К сожалению результат работы промпта всё де придётся проверить, так как текущая реализация AI далека от идеала, но даже так времени можно сэкономить массу.
👀 А как ты приводишь свой код к более современному виду? Делитесь в комментариях!
Есть желание использовать современные языковые фитчи, но переписывать код в ручную долго и скучно, тогда можно воспользоваться помощью искусственного интеллекта😄
Для того чтобы сделать свой код более современным используй следующий промпт:
Refactor the following code to modern [Тут напиши стандарт] programming standards:
[Сюда вставь свой код]
❗️Пример использования промпта:
Refactor the following code to modern c++23 programming standards:
int* createIntArray(int size) { int* arr = new int[size]; for (int i = 0; i < size; ++i) { arr[i] = i * i; } return arr; }
// Option 1: Return a std::vector (recommended for most cases) auto createIntArray(int size) -> std::vector<int> { std::vector<int> arr(size); std::ranges::generate(arr, [i = 0]() mutable { return i * i++; }); return arr; }
// Option 2: Return a std::unique_ptr (if you specifically need heap allocation) auto createIntArrayUnique(int size) -> std::unique_ptr<int[]> { auto arr = std::make_unique<int[]>(size); for (int i = 0; i < size; ++i) { arr[i] = i * i; } return arr; }
Это достаточно простой и быстрый способ привести код к текущему стандарту. К сожалению результат работы промпта всё де придётся проверить, так как текущая реализация AI далека от идеала, но даже так времени можно сэкономить массу.
👀 А как ты приводишь свой код к более современному виду? Делитесь в комментариях!
There are multiple ways you can search for Telegram channels. One of the methods is really logical and you should all know it by now. We’re talking about using Telegram’s native search option. Make sure to download Telegram from the official website or update it to the latest version, using this link. Once you’ve installed Telegram, you can simply open the app and use the search bar. Tap on the magnifier icon and search for a channel that might interest you (e.g. Marvel comics). Even though this is the easiest method for searching Telegram channels, it isn’t the best one. This method is limited because it shows you only a couple of results per search.
The STAR Market, as is implied by the name, is heavily geared toward smaller innovative tech companies, in particular those engaged in strategically important fields, such as biopharmaceuticals, 5G technology, semiconductors, and new energy. The STAR Market currently has 340 listed securities. The STAR Market is seen as important for China’s high-tech and emerging industries, providing a space for smaller companies to raise capital in China. This is especially significant for technology companies that may be viewed with suspicion on overseas stock exchanges.
Библиотека C C разработчика | cpp boost qt from ua